﻿@model Helper.Metadata.UserMetadata

@{
    ViewBag.Title = "Create";
    Layout = null;
}

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

<div style="margin: 10px 10px 10px 10px">

@using (Html.BeginForm())
{
    @Html.ValidationSummary(true) 

        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Password)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Password)
            @Html.ValidationMessageFor(model => model.Password)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.ParentBusiness)
        </div>
        <div class="editor-field">
        @{
            List<Helper.Core.Entity.Business> list = ViewBag.BusinessList;
            var items = new SelectList(list, "Id", "Name");
         }
            @Html.DropDownListFor(model => model.ParentBusiness.Id, @items)            
        </div>

       <div class="editor-label">
            @Html.LabelFor(model => model.Sector)
        </div>
        <div class="editor-field">
        @{
            List<Helper.Core.Entity.Sector> listSec = ViewBag.SectorList;
            var itemsSec = new SelectList(listSec, "Id", "Name");
         }
            @Html.DropDownListFor(model => model.Sector.Id, @itemsSec)            
        </div>
    
        <div class="editor-label">
            @Html.LabelFor(model => model.Role)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.Role, new SelectList(Enum.GetNames(typeof(Helper.Core.Entity.Hierarchy))) )  
        </div>
        <hr />
        <p>
            <input type="submit" value="Criar" />
        </p>
}

</div>